package top.soulblack.purchasesale.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.soulblack.purchasesale.model.GoodsMaterial;

import java.util.List;

/**
 * create by 小川
 */

@Mapper
public interface GoodsMaterialMapper {

    int deleteById(Integer id);

    int insert(GoodsMaterial record);

    int insertSelective(GoodsMaterial record);

    GoodsMaterial selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(GoodsMaterial record);

    int updateByPrimaryKey(GoodsMaterial record);

    @Select("select * from goods_material")
    List<GoodsMaterial> selectAll();

    @Insert("insert into goods_material (name, `describe`, create_time) values (#{name},#{describe}, #{createTime})")
    void addMaterial(GoodsMaterial goodsMaterial);

    @Select("select count(*) from goods_material where name = #{name}")
    int existMaterial(String name);

    @Select("select material from goods where material = #{id}")
    List<Integer> selectMaterial(@Param("id") Integer id);
}
